import React from "react";

const ContestTab=({activekey,setActivekey,setLoading})=>{
    const onSetActivekey=(key)=>{
        setActivekey(key)
        setLoading(true)
        setTimeout(()=>{
            setLoading(false)
        },2000)
        // console.log(activekey);
    }
    const setClassName=(key)=>{
        return activekey===key?'selected':''
    }
    return(
            <ul className={activekey}>
                <li><a href="javascript:;" 
                    onClick={onSetActivekey.bind(null,'all')} 
                    key='all'
                    className={setClassName('all')}>全部</a></li>
                <li><a href="javascript:;" 
                    onClick={onSetActivekey.bind(null,'esport')} 
                    key='esport'
                    className={setClassName('esport')}>电竞赛事</a></li>
                <li><a href="javascript:;" 
                    onClick={onSetActivekey.bind(null,'sport')} 
                    key='sport'
                    className={setClassName('sport')}>体育赛事</a></li>
            </ul>
    )
}

export default ContestTab